package com.jcz.web;

import com.jcz.biz.AuctionBiz;
import com.jcz.bizImpl.AuctionBizImpl;
import com.jcz.entity.Auction;
import com.jcz.entity.Page;
import com.opensymphony.xwork2.Action;

public class pageAction implements Action {
	private Integer pageIndex;
	private Page page;
	private Auction auction;
	
	
	
	public Auction getAuction() {
		return auction;
	}

	public void setAuction(Auction auction) {
		this.auction = auction;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public Integer getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}

	@Override
	public String execute() throws Exception {
		AuctionBiz aBiz=new AuctionBizImpl();
		Page p=new Page();
		/*添加%%，设置为模糊查询  --已改进，修改为在sql添加%*/
		/*if(this.getAuction().getC_cname()!=null||!"".equals(this.getAuction().getC_cname())){
			
			this.getAuction().setC_cname("%"+this.getAuction().getC_cname()+"%");
		}
		if(this.getAuction().getDescribe()!=null||!"".equals(this.getAuction().getDescribe())){
			
			this.getAuction().setDescribe("%"+this.getAuction().getDescribe()+"%");
		}*/
		
		/*从add跳转过来没有pageindex值，需手动赋值*/
		/*if(this.getPageIndex()!=null||!"".equals(this.getPageIndex())){
			
			p.setList(aBiz.findAll(3, this.getPageIndex(),auction));获取list
		}else{
			p.setList(aBiz.findAll(3, 1,auction));获取list

			
		}*/
		if(pageIndex==null||"".equals(pageIndex)){
			this.setPageIndex(1);
		}
		p.setList(aBiz.findAll(3, this.getPageIndex(),auction));/*获取list*/
		p.setPageIndex(this.getPageIndex());
		p.setPageSize(3);
		p.setCount(aBiz.findCount());
		this.setPage(p);
		return "success";
	}

}
